package main

import (
	"fmt"
	"runtime"
)

// goexit 结束当前协程
// 终止后 defer还是会运行
func main() {
	go test()
	for {

	}
}

func test() {
	defer fmt.Println("D")
	fmt.Println("A")
	test2()

}

func test2() {
	defer fmt.Println("C")
	fmt.Println("B")
	runtime.Goexit()
	fmt.Println("E")

}
